import 'package:get/get.dart';
import 'package:love_newf/app/com/http/http_request.dart';
import 'package:love_newf/app/com/model/home_l_ive_item_model.dart';

class LiveListLogic extends GetxController {
  int pageNum = 1;
  int pageSize = 20;
  int listType = 0;

  List<HomeLiveItemModel>? datas;

  Future<List<HomeLiveItemModel>?> getData() async {
    List<HomeLiveItemModel>? data = await HttpRequest()
        .postList<HomeLiveItemModel>("/api/room/roomList", <String, dynamic>{
      "pageNum": pageNum,
      "pageSize": pageSize,
      "listType": listType
    });
    if (data == null) {
      pageSize = 1;
      return datas = null;
    }
    if (pageNum == 1) {
      datas = data;
    } else {
      datas?.addAll(data);
    }
    return datas;
  }
}
